package com.scau.classOnline.dao;

import com.scau.classOnline.entity.Role;
import com.scau.classOnline.entity.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {
    int insert(@Param("username") String username, @Param("password") String password,
               @Param("email") String email, @Param("status") Integer status);

    User selectByUsername(@Param("username") String username);

    User selectByEmail(@Param("email") String email);

    List<Role> selectRolesByUserId(@Param("id") Integer id);

    int insertRolesForUser(@Param("userId") Integer userId, @Param("rids") Integer[] rids);

    int updatePasswordByUserId(@Param("id") Integer id, @Param("password") String encode);

    User selectByPrimaryKey(Integer id);

    int updateUserInfoByPrimaryKey(User record);

    List<User> selectTeacherByUsername(String pattern);// 只能查到老师，status=1写死
}